package o;

import android.os.ParcelFileDescriptor;
import android.util.Log;
import androidx.annotation.NonNull;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class vh<Data> implements vk<File, Data> {
    private final d<Data> ˎ;

    public interface d<Data> {
        void ˋ(Data data) throws IOException;

        Class<Data> ˏ();

        Data ॱ(File file) throws FileNotFoundException;
    }

    public static class b<Data> implements vr<File, Data> {
        private final d<Data> ˎ;

        public b(d<Data> dVar) {
            this.ˎ = dVar;
        }

        @NonNull
        public final vk<File, Data> ˏ(@NonNull vo voVar) {
            return new vh(this.ˎ);
        }

        public final void ॱ() {
        }
    }

    public static class a extends b<InputStream> {
        public a() {
            super(new d<InputStream>() {
                public /* synthetic */ Object ॱ(File file) throws FileNotFoundException {
                    return ˊ(file);
                }

                public InputStream ˊ(File file) throws FileNotFoundException {
                    return new FileInputStream(file);
                }

                public void ˋ(InputStream inputStream) throws IOException {
                    inputStream.close();
                }

                public Class<InputStream> ˏ() {
                    return InputStream.class;
                }
            });
        }
    }

    public static class c extends b<ParcelFileDescriptor> {
        public c() {
            super(new d<ParcelFileDescriptor>() {
                public /* synthetic */ void ˋ(Object obj) throws IOException {
                    ˏ((ParcelFileDescriptor) obj);
                }

                public /* synthetic */ Object ॱ(File file) throws FileNotFoundException {
                    return ˎ(file);
                }

                public ParcelFileDescriptor ˎ(File file) throws FileNotFoundException {
                    return ParcelFileDescriptor.open(file, 268435456);
                }

                public void ˏ(ParcelFileDescriptor parcelFileDescriptor) throws IOException {
                    parcelFileDescriptor.close();
                }

                public Class<ParcelFileDescriptor> ˏ() {
                    return ParcelFileDescriptor.class;
                }
            });
        }
    }

    static final class e<Data> implements sg<Data> {
        private final File ˋ;
        private final d<Data> ˎ;
        private Data ॱ;

        e(File file, d<Data> dVar) {
            this.ˋ = file;
            this.ˎ = dVar;
        }

        public void ˏ(@NonNull rl rlVar, @NonNull o.sg.d<? super Data> dVar) {
            try {
                this.ॱ = this.ˎ.ॱ(this.ˋ);
                dVar.ॱ(this.ॱ);
            } catch (Throwable e) {
                if (Log.isLoggable("FileLoader", 3)) {
                    Log.d("FileLoader", "Failed to open file", e);
                }
                dVar.ˏ(e);
            }
        }

        public void ˏ() {
            if (this.ॱ != null) {
                try {
                    this.ˎ.ˋ(this.ॱ);
                } catch (IOException e) {
                }
            }
        }

        public void ॱ() {
        }

        @NonNull
        public Class<Data> ˋ() {
            return this.ˎ.ˏ();
        }

        @NonNull
        public rz ˎ() {
            return rz.LOCAL;
        }
    }

    public /* synthetic */ boolean ˋ(@NonNull Object obj) {
        return ˎ((File) obj);
    }

    public /* synthetic */ o.vk.c ˎ(@NonNull Object obj, int i, int i2, @NonNull sc scVar) {
        return ˋ((File) obj, i, i2, scVar);
    }

    public vh(d<Data> dVar) {
        this.ˎ = dVar;
    }

    public o.vk.c<Data> ˋ(@NonNull File file, int i, int i2, @NonNull sc scVar) {
        return new o.vk.c(new aai(file), new e(file, this.ˎ));
    }

    public boolean ˎ(@NonNull File file) {
        return true;
    }
}
